feat(bun): upgrade to bun, reduce docker image size by 95%, upgrade docs & ci - #371
Conversation
…ove legacy Dockerfile and entrypoint script
… and implement GitHub Actions for Docker image build and publish
…I routes and maintain dynamic rendering
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
013fcdf to
4994fa7
Compare
There was a problem hiding this comment.
PR Summary
This PR represents a comprehensive migration from Node.js/npm to Bun as the runtime environment and package manager, along with significant Docker configuration improvements and environment variable handling updates.
- Migrated from npm/yarn to Bun, updating all package management commands, scripts, and configurations across the codebase
- Introduced new multi-stage Docker builds with separate configurations for local development (
docker-compose.local.yml) and production (docker-compose.prod.yml) - Added support for local LLM services through
docker-compose.ollama.ymlwith both GPU and CPU configurations - Centralized environment variable handling through a new
env.tsmodule using@t3-oss/env-nextjsfor type-safe validation - Removed local storage mode functionality in favor of always using database synchronization, which could impact offline capabilities
137 file(s) reviewed, 47 comment(s)
Edit PR Review Bot Settings | Greptile
| alias sim-start="cd /workspace && bun run dev" | ||
| alias sim-migrate="cd /workspace/apps/sim && bunx drizzle-kit push" | ||
| alias sim-generate="cd /workspace/apps/sim && bunx drizzle-kit generate" | ||
| alias sim-rebuild="cd /workspace && bun run build && bun run start" |
There was a problem hiding this comment.
logic: sim-rebuild uses 'bun run start' but earlier aliases use 'bun run dev' - this inconsistency could cause confusion
| RUN bun completions > /etc/bash_completion.d/bun | ||
|
|
||
| # Set up shell environment | ||
| RUN echo "export PATH=$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile |
There was a problem hiding this comment.
logic: PATH modification doesn't include $USER_HOME variable, could break for different user configurations
| RUN echo "export PATH=$PATH:/home/$USERNAME/.bun/bin" >> /etc/profile | |
| RUN echo "export PATH=$PATH:$HOME/.bun/bin" >> /etc/profile |
| ARG USERNAME=bun | ||
| ARG USER_UID=1000 | ||
| ARG USER_GID=$USER_UID |
There was a problem hiding this comment.
logic: User creation commands are missing - need to actually create the user before setting up sudo access
| ARG USERNAME=bun | |
| ARG USER_UID=1000 | |
| ARG USER_GID=$USER_UID | |
| ARG USERNAME=bun | |
| ARG USER_UID=1000 | |
| ARG USER_GID=$USER_UID | |
| RUN groupadd --gid $USER_GID $USERNAME \ | |
| && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME |
| bun install || { | ||
| echo "⚠️ bun install had issues but continuing setup..." | ||
| } |
There was a problem hiding this comment.
logic: Silently continuing after bun install failures could leave the environment in an inconsistent state. Consider failing fast here instead.
| bun install || { | |
| echo "⚠️ bun install had issues but continuing setup..." | |
| } | |
| bun install || { | |
| echo "❌ bun install failed. Please check the errors above and try again." | |
| exit 1 | |
| } |
| for pkg in $(echo $NATIVE_DEPS | grep -oP '"[^"]*"' | tr -d '"' | grep -v "trustedDependencies"); do | ||
| echo "Checking compatibility for $pkg..." | ||
| done |
There was a problem hiding this comment.
logic: Native dependency check only logs but takes no action. Should verify/rebuild native dependencies for Bun compatibility.
| COPY . . | ||
|
|
||
| # Installing with full context to prevent missing dependencies error | ||
| RUN bun install --omit dev --ignore-scripts |
There was a problem hiding this comment.
logic: redundant bun install - already copied node_modules from deps stage
|
|
||
| # Required for standalone nextjs build | ||
| WORKDIR /app/apps/sim | ||
| RUN bun install sharp |
There was a problem hiding this comment.
style: sharp installation should be in deps stage to maintain proper layer caching
|
|
||
| # Copy only package files needed for migrations | ||
| COPY package.json bun.lock turbo.json ./ | ||
| COPY apps/sim/package.json ./apps/sim/db/ |
There was a problem hiding this comment.
logic: Incorrect destination path for package.json - should be './apps/sim/' not './apps/sim/db/'
| COPY apps/sim/package.json ./apps/sim/db/ | |
| COPY apps/sim/package.json ./apps/sim/ |
| RUN bun install --omit dev --ignore-scripts && \ | ||
| bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env |
There was a problem hiding this comment.
style: Running bun install twice is inefficient - combine into single command with all packages
| RUN bun install --omit dev --ignore-scripts && \ | |
| bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env | |
| RUN bun install --omit dev --ignore-scripts drizzle-kit drizzle-orm postgres next-runtime-env |
| COPY apps/sim/package.json ./apps/sim/package.json | ||
| COPY apps/sim/lib/env.ts ./apps/sim/lib/env.ts | ||
|
|
||
| WORKDIR /app/apps/sim No newline at end of file |
There was a problem hiding this comment.
logic: No CMD or ENTRYPOINT specified for running migrations
Description
Upgrade to bun, reduce docker image size by 95%, upgrade docs & ci
Type of change
How Has This Been Tested?
Tested manually, ensured everything works.
Checklist:
npm test)Security Considerations:
Additional Information:
In a follow-up PR, we will implement the docker container using this new docker image and make the CLI to publish the new docker image.